Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UrlFilter (WebFilter) #199

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

CedricMoreau
Copy link
Contributor

No description provided.

@alagoutte alagoutte changed the title Urlfilter Add UrlFilter (WebFilter) Nov 16, 2022
@alagoutte
Copy link
Contributor

the CI is not happy : Missing BOM encoding for non-ASCII encoded file 'WebfilterUrlfilter.Tests.ps1' => you need to check the BOM of the file (use the same like other file)

Process {

$invokeParams = @{ }
if ( $PsBoundParameters.ContainsKey('skip') ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not need skip for add ?

}

if ( Get-FGTWebfilterUrlfilter -connection $connection @invokeParams -name $name ) {
Throw "Already a URL profile object using the same name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a => an (URL)


Param(
[Parameter (Mandatory = $false)]
[string]$id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mandatory ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It takes the next ID available, so it doesn't need to be mandatory or specified

$_entry = new-Object -TypeName PSObject

if ( $PsBoundParameters.ContainsKey('url_id') ) {
$_entry | add-member -name "id" -membertype NoteProperty -Value $url_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo ? id => url_id ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id = ID of URL Filter profile
url_id = ID of URL inside that profile

So id =/= url_id


$urlfilter | add-member -name "name" -membertype NoteProperty -Value $name

$urlfilter | add-member -name "id" -membertype NoteProperty -Value $id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this id ?

$_entry = new-Object -TypeName PSObject

if ( $PsBoundParameters.ContainsKey('url_id') ) {
$_entry | add-member -name "id" -membertype NoteProperty -Value $url_id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here about id typo


$_urlfilter | add-member -name "entries" -membertype NoteProperty -Value $urlfilter.entries

if ( $PsBoundParameters.ContainsKey('visibility') ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is always visibility ?

[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'high')]
Param(
[Parameter (Mandatory = $true, ValueFromPipeline = $true, Position = 1)]
#[ValidateScript({ Confirm-FGTWebfilterUrlfilter $_ })]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm...


}

Describe "Add WebFilter UrlFilter" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing some add test

{ Add-FGTWebfilterUrlfilter -name $pester_url1 -url_id 1 -url_type simple -url powerfgt.com -action allow -status enable } | Should -Throw "Already a URL profile object using the same name"
}

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Set and Remove test too

@CedricMoreau
Copy link
Contributor Author

/azp run

Copy link

Commenter does not have sufficient privileges for PR 199 in repo FortiPower/PowerFGT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants